package com.msb.controller;

import com.msb.service.PicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import java.util.Map;

/**
 * Created by 金喆
 */

@Controller
public class DemoController {

    @Autowired
    private PicService picService;

    @GetMapping("/")
    public String showIndex()
    {
        return "index";
    }

    @PostMapping("/upload")
    @ResponseBody
    public Map<String ,Object> upload(MultipartFile imgFile)
    {
        return picService.upload(imgFile);
    }

}
